#include <iostream>
#include <vector>
#include <cstdlib>
#include <ctime>
#include <math.h>
#include <algorithm>
#include <string>
#include <stack>
using namespace std;

int divide(int dividend, int divisor) {
    if(dividend==0)return 0;
    if(dividend == INT_MIN && divisor == -1) return INT_MAX;
    bool negative;
    negative = (dividend ^ divisor) < 0;
    int t = abs(dividend);
    int d = abs(divisor);
    int result = 0;
    for(short i=31;i>=0;i--){
        if((t>>i)>=d){
            result += 1<<i;
            t-=d<<i;
        }
    }
    return negative?-result:result;
}
int main(){

cout<<divide(2147483647,1)<<endl;

    return 0;
}